package com.nantian.nfcm.bms.loan.web;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nantian.nfcm.bms.loan.service.LoanApplicationQueryService;
import com.nantian.nfcm.bms.loan.service.LoanApplicationService;
import com.nantian.nfcm.bms.loan.vo.LoanBean;
import com.nantian.nfcm.bms.loan.vo.MobileLoanBean;
import com.nantian.nfcm.util.vo.GridData;
import com.nantian.nfcm.util.vo.LoginBean;
import com.nantian.nfcm.util.vo.ResultInfo;

/**
 * 手机端的查询
 * @author ljx26_000
 *
 */
@Controller
@RequestMapping("/mobile")
public class MobileAppController {
    private static Logger log = LoggerFactory.getLogger(MobileAppController.class);
    private LoanApplicationQueryService loanApplicationQueryService;

    @Autowired
    public MobileAppController(LoanApplicationQueryService loanApplicationQueryService) {
        this.loanApplicationQueryService = loanApplicationQueryService;
    }
    
    @RequestMapping("/findByCondition.action")
    @ResponseBody
    private ResultInfo findByCondition(int page, int size, MobileLoanBean mobileLoanBean) throws Exception {
        ResultInfo resultInfo = new ResultInfo();
        try {
            GridData<MobileLoanBean> gd = loanApplicationQueryService.find4MobileByCondition(page, size, mobileLoanBean);
            resultInfo.setData(gd.getData());
            resultInfo.setNumber(gd.getNumber());
            resultInfo.setPage(gd.getPage());
            resultInfo.setTotalPage(gd.getTotalPage());
            resultInfo.setSuccess("true");
        } catch (Exception e) {
            log.error(e.getMessage());
            resultInfo.setSuccess("false");
            resultInfo.setData(e.getMessage());
        }
        return resultInfo;
    }
}
